#ifndef PACKET_OPS_H
#define PACKET_OPS_H

#include "core_conf.h"
#include "core_data.h"

#define SLEEP_TIME 1
#define USLEEP_TIME 500

extern struct core_conf core_conf;

#if 1
extern void *_get_packet(unsigned int protocol, char *maker, unsigned long *packet_id, struct core_data **_core_data);
/* REMEMBER: Don't forget use free_packet after get_packet. */
extern void _free_packet(struct core_data *core_date);
extern void _make_tag(int protocol, char *name, struct core_data *core_data);
extern struct core_data *_get_core_data(struct core_data *core_data);
#endif

#define packet_init()	\
		struct core_data *core_data = NULL;	\
		unsigned long packet_id = 0

#define get_packet(p, m)	_get_packet(p, m, &packet_id, &core_data)
#define get_ipsize()		(core_data == NULL ? 0 : core_data->ipsize)
#define get_rawsize()		(core_data == NULL ? 0 : core_data->rawsize)
#define get_core_data()		_get_core_data(core_data)
#define make_tag(p, m)		_make_tag(p, m, core_data)
#define free_packet()		_free_packet(core_data)

#endif
